package com.zzh.l02_mediaprojection

import org.junit.Test

import org.junit.Assert.*
import kotlin.experimental.and

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {

        val b:Byte=-64
       println(b.toInt() and 0xff)
      // println(64 and  0xff)
    }
}

fun bytesToHex(bytes: ByteArray): String {
     val hexArray = "0123456789ABCDEF".toCharArray()

    val hexChars = CharArray(bytes.size * 2)
    for (j in bytes.indices) {
        val v = (bytes[j] and 0xFF.toByte()).toInt()

        hexChars[j * 2] = hexArray[v ushr 4]
        hexChars[j * 2 + 1] = hexArray[v and 0x0F]
    }
    return String(hexChars)
}